/*! \file inheritancesemantic.h
	\author HiddenSeeker

	Returns a semantic notice of inheritance
*/
#include <string>
#include <vector>
#include <set>

class Rename
{
 public:
		 std::string  OldName;
		 std::string  NewName;
		 std::string  Alias;
 public:
	 inline Rename(const std::string & oldname, 
		           const std::string & newname, 
				   const std::string & alias)
	 {
		 OldName=oldname;
		 NewName=newname;
		 Alias=alias;
	 }
};

class InheritanceSemantic
{
 public:
	    std::set<std::string>  m_redefines;
		std::vector<Rename>    m_renames;
		std::set<std::string>  m_set_renames;

		bool                   m_implements; 
 public:
	   inline InheritanceSemantic() {m_implements=false;}

	   inline bool isImplements() const { return m_implements; }
	   inline void setImplements() { m_implements=true; }
	   inline bool getRename(const std::string & oldname,Rename ** rename)
	   {
		   for (unsigned int i=0;i<m_renames.size();i++)
		   {
			   if (m_renames[i].OldName==oldname)
			   {
				   *rename=&(m_renames[i]);
				   return true;
			   }
		   }
		   return false;
	   }
	   inline bool isRedefined(const std::string & name)
	   {
			return m_redefines.find(name)!=m_redefines.end();
	   }
	   inline bool addRename(const std::string & oldname, 
							 const std::string & newname,
							 const std::string & alias)
	   {
		   if (m_set_renames.find(oldname)!=m_set_renames.end())
			   return false;
		   m_set_renames.insert(oldname);
		   m_renames.push_back(Rename(oldname,newname,alias));
		   return true;
	   }
	   inline bool addRedefine(const std::string & name)
	   {
	    if (m_redefines.find(name)!=m_redefines.end())
			return false;
		m_redefines.insert(name);
		return true;
	   }
};
